<ResourceDictionary 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:Microsoft_Windows_Themes="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero"
    xmlns:ctl="clr-namespace:WcfClientGenerator.UI.Controls"
    >
    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="brushes.xaml" />
    </ResourceDictionary.MergedDictionaries>

    <Style x:Key="rootLayoutStyle" TargetType="Grid">
        <Setter Property="Background" Value="{StaticResource windowBackground}" />
    </Style>

    <Style x:Key="projectListStyle" TargetType="ListBox">
        <Setter Property="BorderThickness" Value="0" />
        <Setter Property="Background" Value="{StaticResource windowBackground}" />
    </Style>

    <Style x:Key="projectListItemsPanelStyle" TargetType="WrapPanel">
        <Setter Property="Margin" Value="0" />
        <Setter Property="Background" Value="{StaticResource windowBackground}" />
        <Setter Property="IsItemsHost" Value="True" />
    </Style>

    <Style x:Key="validationMessageStyle" TargetType="TextBlock">
        <Setter Property="Foreground" Value="Red" />
        <Setter Property="TextWrapping" Value="Wrap" />
        <Setter Property="Margin" Value="5,0,0,0" />
        <Setter Property="VerticalAlignment" Value="Center" />
    </Style>

    <Style x:Key="basicGridStyle" TargetType="Grid">
        <Setter Property="Background" Value="{StaticResource windowBackground}" />
        <Style.Triggers>
            <DataTrigger Binding="{Binding Path=IsAdvancedView}" Value="False">
                <DataTrigger.EnterActions>
                    <BeginStoryboard>
                        <Storyboard>
                            <ThicknessAnimation
                                Storyboard.TargetProperty="Margin"
                                To="0"
                                AccelerationRatio=".4"
                                DecelerationRatio=".4"
                                Duration="0:0:0.3" />
                            <BooleanAnimationUsingKeyFrames
                                Storyboard.TargetProperty="IsEnabled"
                                BeginTime="0:0:0.3"
                                Duration="0">
                                <DiscreteBooleanKeyFrame
                                    KeyTime="0"
                                    Value="True" />
                            </BooleanAnimationUsingKeyFrames>
                        </Storyboard>
                    </BeginStoryboard>
                </DataTrigger.EnterActions>
                <DataTrigger.ExitActions>
                    <BeginStoryboard>
                        <Storyboard>
                            <ThicknessAnimation
                                Storyboard.TargetProperty="Margin"
                                To="500,0,0,0"
                                AccelerationRatio=".4"
                                DecelerationRatio=".4"
                                Duration="0:0:0.3" />
                            <BooleanAnimationUsingKeyFrames
                                Storyboard.TargetProperty="IsEnabled"
                                BeginTime="0:0:0.3"
                                Duration="0">
                                <DiscreteBooleanKeyFrame
                                    KeyTime="0"
                                    Value="False" />
                            </BooleanAnimationUsingKeyFrames>
                        </Storyboard>
                    </BeginStoryboard>
                </DataTrigger.ExitActions>
            </DataTrigger>
        </Style.Triggers>
    </Style>

    <Style x:Key="advancedGridStyle" TargetType="Grid">
        <Setter Property="Opacity" Value="0" />
        <Style.Triggers>
            <DataTrigger Binding="{Binding Path=IsAdvancedView}" Value="True">
                <DataTrigger.EnterActions>
                    <BeginStoryboard>
                        <Storyboard>
                            <DoubleAnimation
                                Storyboard.TargetProperty="Opacity"
                                To="1"
                                Duration="0" />
                            <BooleanAnimationUsingKeyFrames
                                Storyboard.TargetProperty="IsEnabled"
                                Duration="0">
                                <DiscreteBooleanKeyFrame
                                    KeyTime="0"
                                    Value="True" />
                            </BooleanAnimationUsingKeyFrames>
                        </Storyboard>
                    </BeginStoryboard>
                </DataTrigger.EnterActions>
                <DataTrigger.ExitActions>
                    <BeginStoryboard>
                        <Storyboard>
                            <DoubleAnimation
                                Storyboard.TargetProperty="Opacity"
                                To="0"
                                Duration="0:0:0.3" />
                            <BooleanAnimationUsingKeyFrames
                                Storyboard.TargetProperty="IsEnabled"
                                Duration="0">
                                <DiscreteBooleanKeyFrame
                                    KeyTime="0"
                                    Value="False" />
                            </BooleanAnimationUsingKeyFrames>
                        </Storyboard>
                    </BeginStoryboard>
                </DataTrigger.ExitActions>
            </DataTrigger>
        </Style.Triggers>
    </Style>

    <Geometry x:Key="DownArrowGeometry">M 0 0 L 3.5 4 L 7 0 Z</Geometry>
    <Style x:Key="ComboBoxReadonlyToggleButton" TargetType="{x:Type ToggleButton}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ToggleButton}">
                    <Microsoft_Windows_Themes:ButtonChrome x:Name="Chrome" BorderBrush="{TemplateBinding BorderBrush}" Background="{TemplateBinding Background}" RenderMouseOver="{TemplateBinding IsMouseOver}" RenderPressed="{TemplateBinding IsPressed}" SnapsToDevicePixels="true">
                        <Grid HorizontalAlignment="Right" Width="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}">
                            <Path x:Name="Arrow" Data="{StaticResource DownArrowGeometry}" Fill="Black" HorizontalAlignment="Center" Margin="3,1,0,0" VerticalAlignment="Center"/>
                        </Grid>
                    </Microsoft_Windows_Themes:ButtonChrome>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsEnabled" Value="false">
                            <Setter Property="Fill" TargetName="Arrow" Value="Red"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>


    <Style x:Key="ComboBoxStyle" TargetType="{x:Type ComboBox}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ComboBox}">
                    <Grid x:Name="MainGrid" SnapsToDevicePixels="true">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*"/>
                            <ColumnDefinition MinWidth="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}" Width="0"/>
                        </Grid.ColumnDefinitions>
                        <Popup x:Name="PART_Popup" AllowsTransparency="true" Grid.ColumnSpan="2" IsOpen="{Binding IsDropDownOpen, RelativeSource={RelativeSource TemplatedParent}}" Margin="1" PopupAnimation="{DynamicResource {x:Static SystemParameters.ComboBoxPopupAnimationKey}}" Placement="Bottom">
                            <Microsoft_Windows_Themes:SystemDropShadowChrome x:Name="Shdw" Color="Transparent" MaxHeight="{TemplateBinding MaxDropDownHeight}" MinWidth="{Binding ActualWidth, ElementName=MainGrid}">
                                <Border x:Name="DropDownBorder" BorderBrush="{DynamicResource {x:Static SystemColors.WindowFrameBrushKey}}" BorderThickness="1" Background="{DynamicResource {x:Static SystemColors.WindowBrushKey}}">
                                    <ScrollViewer x:Name="DropDownScrollViewer">
                                        <Grid RenderOptions.ClearTypeHint="Enabled">
                                            <Canvas HorizontalAlignment="Left" Height="0" VerticalAlignment="Top" Width="0">
                                                <Rectangle x:Name="OpaqueRect" Fill="{Binding Background, ElementName=DropDownBorder}" Height="{Binding ActualHeight, ElementName=DropDownBorder}" Width="{Binding ActualWidth, ElementName=DropDownBorder}"/>
                                            </Canvas>
                                            <ItemsPresenter x:Name="ItemsPresenter" KeyboardNavigation.DirectionalNavigation="Contained" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
                                        </Grid>
                                    </ScrollViewer>
                                </Border>
                            </Microsoft_Windows_Themes:SystemDropShadowChrome>
                        </Popup>
                        <ToggleButton BorderBrush="{TemplateBinding BorderBrush}" Grid.ColumnSpan="2" IsChecked="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" Style="{StaticResource ComboBoxReadonlyToggleButton}" Background="White"/>
                        <ContentPresenter ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}" ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}" Content="{TemplateBinding SelectionBoxItem}" ContentStringFormat="{TemplateBinding SelectionBoxItemStringFormat}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" IsHitTestVisible="false" Margin="{TemplateBinding Padding}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsEnabled" Value="false">
                            <Setter Property="Background" Value="#FFF4F4F4"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="{x:Type Button}" TargetType="{x:Type Button}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Button">
                    <Border Name="RootElement">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup Name="CommonStates">
                                <VisualState Name="Normal" />
                                <VisualState Name="MouseOver">
                                    <Storyboard>
                                        <ColorAnimation Storyboard.TargetName="BorderBrush"  Storyboard.TargetProperty="Color"  To="Black" Duration="0:0:0.2" />
                                        <ColorAnimation Storyboard.TargetName="FontColor"  Storyboard.TargetProperty="Color" To="White" Duration="0:0:0.2" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState Name="Pressed">
                                    <Storyboard>
                                        <ColorAnimation Storyboard.TargetName="BorderBrush"  Storyboard.TargetProperty="Color" To="Transparent" Duration="0:0:0.2" />
                                        <ColorAnimation Storyboard.TargetName="FontColor"  Storyboard.TargetProperty="Color" To="Black" Duration="0:0:0.2" />
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>


                        <Grid Background="Transparent" >
                            <Border BorderBrush="Transparent" BorderThickness="1,1,1,1" Padding="2">
                                <Border.Background>
                                    <SolidColorBrush x:Name="BorderBrush" Color="White"/>
                                </Border.Background>

                                <ContentPresenter x:Name="ContentSite" VerticalAlignment="Center" HorizontalAlignment="Center" ContentSource="Content"
                                                  >
                                    <TextBlock.Foreground>
                                        <SolidColorBrush x:Name="FontColor" Color="Black"/>
                                    </TextBlock.Foreground>
                                </ContentPresenter>
                            </Border>
                        </Grid>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="roundButtonStyle" TargetType="{x:Type Button}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Button">
                    <Border Name="RootElement">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup Name="CommonStates">
                                <VisualState Name="Normal" />
                                <VisualState Name="MouseOver">
                                    <Storyboard>
                                        <ColorAnimation Storyboard.TargetName="BorderBrush"  Storyboard.TargetProperty="Color"  To="Black" Duration="0:0:0.2" />
                                        <ColorAnimation Storyboard.TargetName="FontColor"  Storyboard.TargetProperty="Color" To="White" Duration="0:0:0.2" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState Name="Pressed">
                                    <Storyboard>
                                        <ColorAnimation Storyboard.TargetName="BorderBrush"  Storyboard.TargetProperty="Color" To="Transparent" Duration="0:0:0.2" />
                                        <ColorAnimation Storyboard.TargetName="FontColor"  Storyboard.TargetProperty="Color" To="Black" Duration="0:0:0.2" />
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>


                        <Grid Background="Transparent"
                              Width="{TemplateBinding Width}" 
                              Height="{TemplateBinding Height}" 
                              ClipToBounds="True">
                            <Ellipse x:Name="outerBorder" 
                                HorizontalAlignment="Stretch" 
                                VerticalAlignment="Stretch" 
                                Stroke="Transparent">
                                <Ellipse.Fill>
                                    <SolidColorBrush x:Name="BorderBrush" Color="White"/>
                                </Ellipse.Fill>
                            </Ellipse>
                            <DockPanel  Name="contentPresenterPanel">
                                <Border Padding="2" BorderThickness="0" Background="Transparent">
                                    <Grid Background="Transparent">
                                        <Image x:Name="ButtonImage" 
                                       Source="{Binding NormalImage, RelativeSource={RelativeSource TemplatedParent}}" 
                                       Height="{Binding ImageSize, RelativeSource={RelativeSource TemplatedParent}}" 
                                       Width="{Binding ImageSize, RelativeSource={RelativeSource TemplatedParent}}"/>

                                        <ContentPresenter 
                                            x:Name="myContentPresenter" 
                                            VerticalAlignment="Center" HorizontalAlignment="Center"
                                            Content="{TemplateBinding  Content}">
                                            <TextBlock.Foreground>
                                                <SolidColorBrush x:Name="FontColor" Color="Black"/>
                                            </TextBlock.Foreground>
                                        </ContentPresenter>
                                    </Grid>
                                </Border>
                            </DockPanel>
                        </Grid>
                    </Border>

                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="true">
                            <Setter TargetName="ButtonImage" Property="Source" Value="{Binding HoverImage, RelativeSource={RelativeSource TemplatedParent}}" />
                        </Trigger>
                        <Trigger Property="IsPressed" Value="true">
                            <Setter TargetName="ButtonImage" Property="Source" Value="{Binding PressedImage, RelativeSource={RelativeSource TemplatedParent}}" />
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="false">
                            <Setter TargetName="ButtonImage" Property="Source" Value="{Binding DisabledImage, RelativeSource={RelativeSource TemplatedParent}}" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="advancedButtonStyle" BasedOn="{StaticResource roundButtonStyle}" TargetType="{x:Type Button}">
        <Setter Property="RenderTransformOrigin" Value="0.5,0.5" />
        <Style.Triggers>
            <DataTrigger Binding="{Binding Path=IsAdvancedView}" Value="True">
                <DataTrigger.EnterActions>
                    <BeginStoryboard>
                        <Storyboard>
                            <DoubleAnimation
                                Storyboard.TargetProperty="(Button.RenderTransform).(RotateTransform.Angle)"
                                To="180"
                                Duration="0:0:0.3" />
                        </Storyboard>
                    </BeginStoryboard>
                </DataTrigger.EnterActions>
                <DataTrigger.ExitActions>
                    <BeginStoryboard>
                        <Storyboard>
                            <DoubleAnimation
                                Storyboard.TargetProperty="(Button.RenderTransform).(RotateTransform.Angle)"
                                To="0"
                                Duration="0:0:0.3" />
                        </Storyboard>
                    </BeginStoryboard>
                </DataTrigger.ExitActions>
            </DataTrigger>
        </Style.Triggers>
    </Style>

    <Style x:Key="buttonLabelStyle" TargetType="TextBlock">
        <Setter Property="FontSize" Value="10" />
        <Setter Property="TextTrimming" Value="CharacterEllipsis" />
    </Style>

    <Style x:Key="titleStyle" TargetType="TextBlock">
        <Setter Property="FontSize" Value="14" />
        <Setter Property="TextTrimming" Value="CharacterEllipsis" />
        <Setter Property="Margin" Value="8,8,4,16" />
        <Setter Property="FontWeight" Value="Bold" />
    </Style>

    <Style TargetType="ListBoxItem">
        <Style.Resources>
            <!--SelectedItem without focus-->
            <SolidColorBrush x:Key="{x:Static SystemColors.ControlBrushKey}" Color="LightBlue" Opacity=".7"/>
        </Style.Resources>
    </Style>
    
    <Style x:Key="noBorderWindowStyle" TargetType="Window">
        <Setter Property="WindowStyle" Value="None" />
        <Setter Property="Background" Value="{x:Null}" />
        <Setter Property="AllowsTransparency" Value="True" />
    </Style>
    
    <Style x:Key="captionRectangleStyle" TargetType="Rectangle">
        <Setter Property="Fill" Value="{StaticResource windowBackground}" />
        <Setter Property="HorizontalAlignment" Value="Stretch" />
        <Setter Property="VerticalAlignment" Value="Stretch" />
    </Style>
</ResourceDictionary>
